<?
/**
 *
 * $list = select_image_row($table,$new_detail_nid);
    $img_path_pix = '../../uploadfiles/' . $theme_folder . '/';
    delect_local_img($tempdata2,$list,$img_path_pix);
 *
 * @param $newList 新数组
 * @param $list 旧数组   更新前的数组，用来匹配更新过的照片进行删除
 * @param $filePath 文件路径 '../../uploadfiles/' . $theme_folder . '/'
 */
function delect_local_img($newList,$list,$filePath)
{

    foreach (array_keys($newList) as $value) {

        if(!empty($list[$value]) && $newList[$value] != $list[$value]){
            if(file_exists($filePath.$list[$value])){
                if (!unlink($filePath.$list[$value]))
                {
                    echo ("Error deleting $list[$value]");
                }
                else
                {
                    echo ("Deleted $list[$value]");
                }
            }

        }
    }


 }

?>